123456/H5 2324/overzicht.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<?php
if($_GET['a'] && $_GET['b']){
$a = $_GET['a'];
$b = $_GET['b'];
$c = schuinezijde($a,$b);
echo "De schuine zijde van een driehoek met rechthoekzijdes $a en $b is $c.";
}
function schuinezijde($a, $b){
$c= sqrt($a*$a + $b * $b);
if(round($c) == $c){
return $c;
}
else{
$c2= $a*$a + $b * $b;
return "√$c2";
}
}
?>
<form>
A: <input type='text' name='a'>
B: <input type='text' name='b'>
<input type='submit' value='Bereken'>
</form>
</body>
</html>
Resultaat
Made by Thijs Aarnoudse